﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LimitOrderBookSim.Commons;

namespace LimitOrderBookSim.Assets
{
    public class Order
    {

        public int ID { get; set; }
        //public String Symbol { get; set; }
        public int Size { get; set; }
        public double Price { get; set; }
        public TYPE Type { get; set; }

        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 17;
                //hash = hash * 23 + Symbol.GetHashCode();
                hash = hash * 23 + Size.GetHashCode();
                hash = hash * 23 + Price.GetHashCode();
                hash = hash * 23 + Type.GetHashCode();
                return hash;
            }
        }


        public override bool Equals(object obj)
        {
            bool result = false;

            if (null != obj && this.GetType() == obj.GetType())
            {
                if (((Order)obj).ID == this.ID)
                {
                    result = true;
                }
            }

            return result;
        }

        public override string ToString()
        {
            return String.Format(
                "{0};{1};{2};{3};{4}",
                ID,
               // Symbol,
                Price,
                Size,
                Type.ToString());
        }
    }
}
